@use '@styles/variables.scss' as *;
@use '@styles/mixin.scss' as *;

.header-bar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 65px;
  padding: 0 32px;
  background: var(--art-main-bg-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  cursor: pointer;
  .logo-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-right: 8px;
  }
  .title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }
}

// 修复头像区域
.avatar-box {
  position: relative;
  width: 55px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;

  .avatar-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    img.avatar {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 12px;
    }
  }

  .status-dot {
    @include circle(12px);
    position: absolute;
    bottom: -2px;
    right: -2px;
    border: 2px solid var(--art-main-bg-color);
    &.is-online  { background-color: rgb(var(--art-success)); }
    &.is-offline { background-color: rgb(var(--art-gray-400-rgb)); }
    &.is-error   { background-color: rgb(var(--art-danger)); }
  }
}

// 导航容器居中
.nav-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 32px; // 给导航左右留出空间
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
}

.nav-item-wrapper {
  position: relative;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #555;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  user-select: none;

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #94a3b8;
    transition: all 0.3s ease;
    transform: translateX(-50%);
  }

  &:hover {
    background: rgba(0, 0, 0, 0.05);

    &::after {
      width: 80%;
    }
  }

  &.hovered {
    background: rgba(0, 0, 0, 0.05);

    &::after {
      width: 80%;
      background: #64748b;
    }
  }

  &.active {
    background: #d1d5db;
    color: #000;
    font-weight: 600;

    &::after {
      width: 80%;
      background: #4b5563;
    }
  }

  .nav-text {
    position: relative;
    z-index: 2;
  }

  .dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s ease;
  }
}

.sub-nav {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--art-main-bg-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 120px;
  padding: 8px 0;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;

  &.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .sub-nav-item {
    padding: 8px 16px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background: rgba(0, 0, 0, 0.05);
      color: #000;
    }

    &.active {
      background: #d1d5db;
      color: #000;
      font-weight: 500;
    }
  }
}

.user {
  display: flex;
  align-items: center;
}